//
// Copyright (c) 2011 Alex Nesterenko
//

#ifndef NANE_OGLWIN32WINDOWCONTEXT_H
#define	NANE_OGLWIN32WINDOWCONTEXT_H

#include "nane/RenderSystem/ogl/OGLWindowContext.h"
#include "nane/core/crt/DynamicModule.h"
#include "nane/core/WinAPI/winapi.h"

extern "C"
{
    typedef HGLRC (WINAPI *PFUNCWGLCREATECONTEXT)(HDC);
    typedef BOOL (WINAPI *PFUNCWGLMAKECURRENT)(HDC,HGLRC);
    typedef BOOL (WINAPI *PFUNCWGLDELETECONTEXT)(HGLRC);
}
namespace nane
{
    class OGLWin32WindowContext
        : public OGLWindowContext
    {
    public:
        OGLWin32WindowContext();
        ~OGLWin32WindowContext();

    public:
        bool initialize( IWindow::OSHandle _windowHandle );
        void shutdown();
        void swapBuffers();

    private:
        IWindow::OSHandle m_windowHandle;
        HDC m_hdc;
        HGLRC m_hglrc;
        PFUNCWGLCREATECONTEXT m_pWglCreateContext;
        PFUNCWGLMAKECURRENT m_pWglMakeCurrent;
        PFUNCWGLDELETECONTEXT m_pWglDeleteContext;
        ModuleHandle* m_hOpenGL;
    };
}   // namespace nane

#endif	// NANE_OGLWIN32WINDOWCONTEXT_H
